package com.explorati.LeetCode010.fib;

import java.util.Arrays;

/**
 * @ Author : Weijian_Wang
 * @ Date : Created in 23:55 2020/10/5 0005
 * @ Description ：
 */
public class Solution1 {

    public int fib(int n) {
        int[] memo = new int[n + 1];
        Arrays.fill(memo, -1);

        memo[0] = 0;
        memo[1] = 1;
        for(int i = 2; i <= n; i ++) {
            memo[i] = memo[i - 1] + memo[i - 2];
        }

        return memo[n];
    }
}
